<%@ page import="java.util.Objects" %>
<%@ page import="com.fhd.constant.Constants" %><%--
  Created by IntelliJ IDEA.
  User: 44252
  Date: 2025/3/25
  Time: 21:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Login</title>
</head>
<body>
    <div>
        <h1>欢迎来到住哪儿app</h1>
        <h3>请登录：</h3>
    </div>
    <%
        // 客户修改信息
        String object = (String)request.getSession().getAttribute(Constants.UPDATE_MESSAGE);
        if (!Objects.isNull(object)) {
            out.print("<h2 style=\"color: red\">" + object + "</h2>");
            request.getSession().removeAttribute(Constants.UPDATE_MESSAGE);
        }

        // 商户修改信息
        String object1 = (String)request.getSession().getAttribute(Constants.UPDATE_MERCHANT_MESSAGE);
        if (!Objects.isNull(object1)) {
            out.print("<h2 style=\"color: red\">" + object1 + "</h2>");
            request.getSession().removeAttribute(Constants.UPDATE_MERCHANT_MESSAGE);
        }
    %>
    <form method="post" action="<%=request.getContextPath()%>/login.do">
        <%
            // 登录返回信息
            String loginMessage = (String)request.getSession().getAttribute(Constants.LOGIN_MESSAGE);
            if (loginMessage != null) {
                out.print("<h4 style=\"color: red\">" + loginMessage + "</h4>");
                request.getSession().removeAttribute(Constants.LOGIN_MESSAGE);
            }
            // 注册返回信息
            String signUpMessage = (String)request.getSession().getAttribute(Constants.SIGN_UP_MESSAGE);
            if (signUpMessage != null) {
                out.print("<h4 style=\"color: red\">" + signUpMessage + "</h4>");
                request.getSession().removeAttribute(Constants.SIGN_UP_MESSAGE);
            }
        %>
        <div>
            <label for="userCode">账号：</label>
            <input type="text" name="userCode" id="userCode" required maxlength="20">
        </div>
        <br>
        <div>
            <label for="userPassword">密码：</label>
            <input type="password" name="userPassword" id="userPassword" required maxlength="20">
        </div>
        <br>
        <div>
            <span>请选择您的用户类型</span>
        </div>
        <br>
        <div>
            <label><input type="radio" name="roleId" value="1" checked>客户</label>
            <label><input type="radio" name="roleId" value="2">商户</label>
            <label><input type="radio" name="roleId" value="3">管理端</label>
        </div>
        <br>
        <div>
            <input type="submit">
        </div>
        <br>
    </form>
    <h4>没有账号？点击你要注册的角色来注册账号</h4>
    <a href="signUpClient.jsp">注册客户</a>
    <a href="signUpMerchant.jsp">注册商户</a>


</body>
</html>
